package util;

import java.io.*;

/** A Message object represents a single message to the chat
 * room consisting of a name and a string of text. */

public class Message implements Serializable {
  
  private String myName;
  private String destinationName;
  private String myText;

  public Message()
    {
      this( "", "","" );
    }

  public Message( String name, String destinationName,String text )
    {
      this.myName = name;
      this.myText = text;
      this.destinationName=destinationName;
    }

  public Message(String text){
      myText=text;
  }

  public void setName( String name )
    {
      myName = name;
    }

  public void setText( String text )
    {
      myText = text;
    }

  public String getName()
    {
      return myName;
    }

  public String getText()
    {
      return myText;
    }

    public String getDestinationName() {
        return destinationName;
    }

    public void setDestinationName(String destinationName) {
        this.destinationName = destinationName;
    }

  
    @Override
  public String toString()
    {
      StringBuffer sb = new StringBuffer();
      sb.append( myName );
      sb.append( ": " );
      sb.append( myText );
      return sb.toString();
    }
}
